<ui:composition xmlns="http://www.w3.org/1999/xhtml"
			    xmlns:ui="http://java.sun.com/jsf/facelets"
			    xmlns:h="http://java.sun.com/jsf/html"
			    xmlns:f="http://java.sun.com/jsf/core"
			    xmlns:rich="http://richfaces.org/rich"
			    template="/WEB-INF/layout/template.xhtml">
	
	<ui:define name="title">
		<h:outputText value="#{i18n['panelGridDetails.title']}"/>
	</ui:define>

	<ui:define name="contents">
		<h:outputText value="#{i18n['tabelle.keineKunden']}"
		              rendered="#{empty kv.detailsKunde}"/>

		<h1>
			<h:outputFormat value="#{i18n['panelGridDetails.heading']}"
			                rendered="#{not empty kv.detailsKunde}">
				<f:param value="#{kv.detailsKunde.vorname}"/>
				<f:param value="#{kv.detailsKunde.nachname}"/>
			</h:outputFormat>
		</h1>

		<rich:tabPanel rendered="#{not empty kv.detailsKunde}">
			<rich:tab>
				<f:facet name="label">
					<h:panelGroup>
						<h:graphicImage value="/images/stammdaten.gif"/>
						&#160;
						<h:outputText value="#{i18n['panelGridDetails.kunde.stammdaten']}" />
					</h:panelGroup>
				</f:facet>
				<h:panelGrid id="ausgewaehlterKunde"
				             columns="3"
				             columnClasses="kundendetailsBezeichner, kundendetailsDaten">
					<h:outputText value="#{i18n['panelGridDetails.kunde.id']}"/>
					<h:outputText value="#{kv.detailsKunde.id}"/>
					<h:outputText value=""/>
		
					<h:outputText value="#{i18n['panelGridDetails.kunde.nachname']}"/>
					<h:outputText value="#{kv.detailsKunde.nachname}"/>
					<h:outputText value=""/>
		
					<h:outputText value="#{i18n['panelGridDetails.kunde.vorname']}"/>
					<h:outputText value="#{kv.detailsKunde.vorname}"/>
					<h:outputText value=""/>
		
					<h:outputText value="#{i18n['panelGridDetails.kunde.kategorie']}"/>
					<h:outputText value="#{kv.detailsKunde.kategorie}"/>
					<h:outputText value=""/>
					
					<h:outputText value="#{i18n['panelGridDetails.kunde.umsatz']}"/>
					<h:outputText value="#{kv.detailsKunde.umsatz}">
						<f:convertNumber type="currency" currencyCode="EUR"/>
					</h:outputText>
					<h:outputLink value="http://www.exchangerate.com/quick_calculator.html?amount_from=#{kunde.umsatz}&#38;calc_short_from_iso=EUR&#38;calc_short_to_iso=USD&#38;Submit=Convert"
					              target="_blank">
						<h:outputText value="#{i18n['waehrung.umrechnen']}"/>
					</h:outputLink>
					
					<h:outputText value="#{i18n['panelGridDetails.kunde.seit']}"/>
					<h:outputText value="#{kv.detailsKunde.seit}"/>
					<h:outputText value=""/>
					
					<h:outputText value="#{i18n['panelGridDetails.kunde.email']}"/>
					<h:outputText value="#{kv.detailsKunde.email}"/>
					<h:outputText value=""/>
					
					<h:outputText value="#{i18n['panelGridDetails.kunde.creditCard']}"
					              rendered="#{kv.detailsKunde.creditCard ne 'NONE'}"/>
					<h:outputText value="#{kv.detailsKunde.creditCard}"
					              rendered="#{kv.detailsKunde.creditCard ne 'NONE'}"/>
					<h:outputText value=""
					              rendered="#{kv.detailsKunde.creditCard ne 'NONE'}"/>
					
					<h:outputText value="#{i18n['panelGridDetails.kunde.creditCardId']}"
					              rendered="#{kv.detailsKunde.creditCard ne 'NONE'}"/>
					<h:outputText value="#{kv.detailsKunde.creditCardId}"
					              rendered="#{kv.detailsKunde.creditCard ne 'NONE'}"/>
					<h:outputText value=""
					              rendered="#{kv.detailsKunde.creditCard ne 'NONE'}"/>
		
					<h:outputText value="#{i18n['panelGridDetails.kunde.art']}"/>
					<h:outputText value="#{kv.detailsKunde.art}"/>
					<h:outputText value=""/>
					
					<h:outputText value="#{i18n['panelGridDetails.kunde.rabatt']}"
					              rendered="#{kv.detailsKunde.art eq 'F'}"/>
					<h:outputText value="#{kv.detailsKunde.rabatt}"
					              rendered="#{kv.detailsKunde.art eq 'F'}">
						<f:convertNumber type="percent" minFractionDigits="1" maxFractionDigits="2"/>
					</h:outputText>
					<h:outputText value=""
					              rendered="#{kv.detailsKunde.art eq 'F'}"/>
				</h:panelGrid>
			</rich:tab>
		
			<rich:tab rendered="#{not empty kv.detailsKunde.dateiname}">
				<f:facet name="label">
					<h:panelGroup>
						<h:graphicImage value="/images/bild.gif"/>
						&#160;
						<h:outputText value="#{i18n['panelGridDetails.kunde.bild']}" />
					</h:panelGroup>
				</f:facet>
				<h:graphicImage id="bild"
				                url="#{initParam.hskaUploadDir}/#{kv.detailsKunde.dateiname}"
				                alt="#{i18n['panelGridDetails.kunde.bild.alt']}"/>
			</rich:tab>
		
			<rich:tab rendered="#{not empty kv.detailsKunde.bestellungen}">
				<f:facet name="label">
					<h:panelGroup>
						<h:graphicImage value="/images/bestellungen.gif"/>
						&#160;
						<h:outputText value="#{i18n['tabelle.kunde.bestellungen']}" />
					</h:panelGroup>
				</f:facet>
				<h:dataTable id="bestellungenTabelle"
				             value="#{kv.detailsKunde.bestellungen}"
				             var="bestellung">
					<rich:column>
						<rich:simpleTogglePanel label="#{i18n['bestellung']} #{bestellung.id}"
						                        opened="false"
						                        width="100%"
						                        heigth="100%">
							<rich:dataTable id="bestellungTabelle"
							                value="#{bestellung.bestellpositionen}"
							                var="bp">
								<rich:column>
									<f:facet name="header">
										<h:outputText value="#{i18n['bestellung.anzahl']}"/>
									</f:facet>
									<h:outputText value="#{bp.anzahl}"/>
								</rich:column>
								<rich:column>
									<f:facet name="header">
										<h:outputText value="#{i18n['bestellung.artikel']}"/>
									</f:facet>
									<h:outputText value="#{bp.artikel.bezeichnung}"/>
								</rich:column>
							</rich:dataTable>
						</rich:simpleTogglePanel>
					</rich:column>
				</h:dataTable>
			</rich:tab>
		</rich:tabPanel>
	</ui:define>
</ui:composition>
